package crafex.engine.tools;

import java.io.Serializable;

public class IntVertex2D implements Serializable{
	/**serail*/
	private static final long serialVersionUID = -1647489423365366965L;
	/**the x coordinate of the vertex*/
	private int x;
	/**the x coordinate of the vertex*/
	private int y;
	
	/**
	 * used to hold the coordinates of an object
	 */
	public IntVertex2D(){
		x = 0;
		y = 0;
	}
	
	/**
	 * used to hold the coordinates of an object
	 * @param x coordinate of object.
	 * @param y coordinate of object.
	 */
	public IntVertex2D(int x, int y){
		setX(x);
		setY(y);
		
	}
	
	/**
	 * sets the coordinates of the vertex.
	 * @param x coordinate of vertex.
	 * @param y coordinate of vertex.
	 */
	public void setVertex(int x, int y){
		this.x = x;
		this.y = y;
	}
	
	/**
	 * sets the x coordinate of vertex.
	 * @param x coordinate of vertex.
	 */
	public void setX(int x){
		this.x = x;
	}
	
	/**
	 * @return x coordinate of vertex.
	 */
	public int getX(){
		return x;
	}
	
	/**
	 * adds to the x coordinate of the vertex.
	 * @param addition, amount added to the x coordinate.
	 */
	public void addToX(int addition){
		setX(getX() + addition);
	}
	
	/**
	 * sets the y coordinate of vertex.
	 * @param y coordinate of vertex.
	 */
	public void setY(int y){
		this.y = y;
	}
	
	/**
	 * @return x coordinate of vertex.
	 */
	public int getY(){
		return y;
	}
	
	/**
	 * adds to the x coordinate of the vertex.
	 * @param addition, amount added to the y coordinate.
	 */
	public void addToY(int addition){
		setY(getY() + addition);
	}
	
	/**
	 * adds a intvertex to this
	 * @param addition
	 */
	public void addto(IntVertex2D addition){
		this.addToX(addition.getX());
		this.addToY(addition.getY());
	}
	/**
	 * sets the x and y coordinates to 0.
	 */
	public void reset(){
		x = 0;
		y = 0;
	}
}
